using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Reportes;
using BerkoRules.Mappers;
using Microsoft.VisualBasic.CompilerServices;

namespace Berko
{
    public partial class frmRptXCumple : Form
    {
        public frmRptXCumple()
        {
            InitializeComponent();
        }

        private void cmdFecha_Click(object sender, EventArgs e)
        {
            DateTime time;
            this.Cursor = Cursors.WaitCursor;
            this.cmdFecha.Enabled = false;
            this.cmdFecha.Refresh();
            rpt_Cumple cumple = new rpt_Cumple();
            DataSet dataSet = new DataSet();
            DataTable table = new DataTable("dt_Cumple");
            if (this.txtDesde.Text != "")
            {
                time = DateTime.Parse(this.txtDesde.Text);
            }
            else
            {
                MessageBox.Show("Debe ingresar una fecha v\x00e1lida", "Fecha inv\x00e1lida", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                this.txtDesde.Focus();
                this.Cursor = Cursors.Default;
                this.cmdFecha.Enabled = true;
                return;
            }
            try
            {
                table = Clientes_PersonasMapper.Instance().RPT_Traer_Cumple(time).Copy();
                table.TableName = "dt_Cumple";
                dataSet.Tables.Add(table);
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                this.Cursor = Cursors.Default;
                this.cmdFecha.Enabled = true;
                ProjectData.ClearProjectError();
                return;
                ProjectData.ClearProjectError();
            }
            cumple.SetDataSource(dataSet);
            this.rptVisor.ReportSource = cumple;
            this.rptVisor.RefreshReport();
            this.Cursor = Cursors.Default;
            this.cmdFecha.Enabled = true;
        }

        private void frmRptXPatente_Load(object sender, EventArgs e)
        {
            this.txtDesde.Text = DateTime.Now.ToString("ddMMyy");
        }



    }
}